<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%-- <%String contextPath = request.getContextPath();%> --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Dashboard">
<meta name="keyword"
	content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
<title>Dashio - Bootstrap Admin Template</title>
<!-- Favicons -->
<link href="${pageContext.request.contextPath }/img/favicon.png" rel="icon">
<link href="${pageContext.request.contextPath }/img/apple-touch-icon.png" rel="apple-touch-icon">
<!-- Bootstrap core CSS -->
<link href="${pageContext.request.contextPath }/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!--external css-->
<link href="${pageContext.request.contextPath }/lib/font-awesome/css/font-awesome.css" rel="stylesheet" />
<link rel="stylesheet" t/ype="text/css"
	href="${pageContext.request.contextPath }/css/zabuto_calendar.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/lib/gritter/css/jquery.gritter.css" />
<!-- Custom styles for this template -->
<link href="${pageContext.request.contextPath }/css/style.css" rel="stylesheet">
<link href="${pageContext.request.contextPath }/css/style-responsive.css" rel="stylesheet">
<!-- <script src="../lib/chart-master/Chart.js"></script> -->

<!-- =======================================================
    Template Name: Dashio
    Template URL: https://templatemag.com/dashio-bootstrap-admin-template/
    Author: TemplateMag.com
    License: https://templatemag.com/license/
  ======================================================= -->
</head>

<body>
	<section id="container">
		<!-- **********************************************************************************************************************************************************
        TOP BAR CONTENT & NOTIFICATIONS
        *********************************************************************************************************************************************************** -->
		<!--header start-->
		<header class="header black-bg">
			<div class="sidebar-toggle-box">
				<div class="fa fa-bars tooltips" data-placement="right"
					data-original-title="Toggle Navigation"></div>
			</div>
			<!--logo start-->
			<a href="index.jsp" class="logo"><b>BES<span>Manage</span></b></a>
			<!--logo end-->

			<div class="top-menu">
				<ul class="nav pull-right top-menu">
					<li><a class="logout" href="${pageContext.request.contextPath }/back/login.jsp">退出登录</a></li>
				</ul>
			</div>
		</header>
		<!--header end-->
		<!-- **********************************************************************************************************************************************************
        MAIN SIDEBAR MENU
        *********************************************************************************************************************************************************** -->
		<!--sidebar start-->
		<aside>
			<div id="sidebar" class="nav-collapse ">
				<!-- sidebar menu start-->
				<ul class="sidebar-menu" id="nav-accordion">
					<p class="centered"><a href="index.jsp">
			        	<!--管理员头像-->
			          <!-- 默认头像 -->
						<c:if test="${sessionScope.backUser.u_img ==null}">
							<img  src="${pageContext.request.contextPath }/images/ui-sam.jpg" class="img-circle" width="80" />
						</c:if>
						<!-- 自定义头像 -->
						<c:if test="${sessionScope.backUser.u_img !=null}">
							<img  src="${pageContext.request.contextPath }/DownloadServlet?fileName=${sessionScope.backUser.u_img}"  class="img-circle" width="80" />
						</c:if>
			          </a></p>
			          <!--管理员名-->
			          <h5 class="centered">${sessionScope.backUser.u_name}</h5>
					<li class="mt"><a href="index.jsp"> <i
							class="fa fa-dashboard"></i> <span>公司信息</span>
					</a></li>
					<li class="sub-menu"><a class="active" href="javascript:;"> <i
							class="fa fa-desktop"></i> <span>用户管理</span>
					</a>
						<ul class="sub">
							<li><a href="${pageContext.request.contextPath }/back/user-information.jsp">用户信息</a></li>
							<li class="active"><a href="${pageContext.request.contextPath }/back/adduser.jsp">添加用户</a></li>
						</ul></li>
					<li class="sub-menu"><a href="javascript:;"> <i
							class="fa fa-tasks"></i> <span>车次管理</span>
					</a>
						<ul class="sub">
							<li><a href="${pageContext.request.contextPath }/back/bus-information.jsp">车次信息</a></li>
							<li><a href="${pageContext.request.contextPath }/back/moment-information.jsp">时刻信息</a></li>
							<li><a href="${pageContext.request.contextPath }/back/addmoment.jsp">添加时刻表</a></li>
							<li><a href="${pageContext.request.contextPath }/back/addsite.jsp">添加车次</a></li>
						</ul></li>
					<li class="sub-menu"><a href="javascript:;"> <i
							class="fa fa-th"></i> <span>站点管理</span>
					</a>
						<ul class="sub">
							<li><a href="${pageContext.request.contextPath }/back/bussite-information.jsp">站点信息</a></li>
							<li><a href="${pageContext.request.contextPath }/back/addbussite.jsp">添加站点</a></li>
							<li><a href="${pageContext.request.contextPath }/back/addbusSites.jsp">新增站点</a></li>
						</ul></li>

					<li class="sub-menu"><a href="javascript:;"> <i
							class="fa fa-comments-o"></i> <span>公告栏管理</span>
					</a>
						<ul class="sub">
							<li><a href="${pageContext.request.contextPath }/back/announcement.jsp">公告栏信息</a></li>
						</ul></li>
					<li>
						 <a href="${pageContext.request.contextPath }/back/baidu_maps.jsp">
				              <i class="fa fa-map-marker"></i>
				              <span>百度地图</span>
				         </a>
					</li>
				</ul>
				<!-- sidebar menu end-->
			</div>
			<!--sidebar start-->
		</aside>
		<!--sidebar end-->
		<!--main content start-->
		<section id="main-content">
			<section class="wrapper">
				<!-- /row -->
				<div class="row mt">
					<div class="col-lg-12 ">
						<h3>
							<i class="fa fa-angle-right"></i>添加用户
						</h3>
						<div class="form-panel col-lg-4">
							<div class="form">
								<h3><i class="fa fa-user"></i>新增用户信息</h3></br>
								<form class="cmxform form-horizontal style-form col-md-12" id="regForm"
									method="post"
									action="${pageContext.request.contextPath }/UserController?op=sign">
									<div class="form-group">
										<label for="firstname" class="control-label col-lg-3">用户名</label>
										<div class="col-lg-9">
											<input class=" form-control" id="username" name="username"
												type="text" />
											<!-- 显示用户名的提示 -->
											<label id="userNameId"></label>
										</div>
									</div>
									<div class="form-group ">
										<label for="password" class="control-label col-lg-3">密码</label>
										<div class="col-lg-9">
											<input class="form-control " id="password" name="password"
												type="password" />
											<!-- 密码的提示 -->
											<label id="userPwdId"></label>
										</div>
									</div>
									<div class="form-group ">
										<label for="lastname" class="control-label col-lg-3">手机号</label>
										<div class="col-lg-9">
											<input class="form-control" id="usertel" name="usertel"
												type="text" />
											<!-- 手机号码的提示 -->
											<label id="userTelId"></label>
										</div>
									</div>
									<div class="form-group ">
										<label for="confirm_sex" class="control-label col-lg-3">性别</label>
										<div class="col-lg-6">
											<select class="form-control" id="sex" name="sex">
												<option value="男">请选择</option>
												<option value="男">男</option>
												<option value="女">女</option>
											</select>
										</div>
									</div>
									<div class="form-group ">
										<label for="confirm_password" class="control-label col-lg-3">等级</label>
										<div class="col-lg-6">
											<select class="form-control" id="userlevel" name="userlevel">
												<option value="1">请选择</option>
												<option value="1">普通用户</option>
												<option value="2">管理员</option>
											</select>
										</div>
									</div>
									<div class="form-group ">
										<label for="confirm_password" class="control-label col-lg-3">状态</label>
										<div class="col-lg-6">
											<select class="form-control" id="userstatus"
												name="userstatus">
												<option value="1">请选择</option>
												<option value="0">禁用</option>
												<option value="1">启用</option>
											</select>
										</div>
									</div>

									<div class="form-group">
										<div class="col-lg-offset-2 col-lg-12">
											<div class="col-lg-4">
												<button class="btn btn-theme" type="submit">提交</button>
											</div>
											<div class="col-lg-4">
												<button class="btn btn-theme04" type="button">清空</button>
											</div>
										</div>
									</div>
								</form>
							</div>
						</div>
						<!-- /form-panel -->
					</div>
					<!-- /col-lg-12 -->
				</div>
				<!-- /row -->
			</section>
		</section>
		<!--main content end-->
		<!--footer start-->
		<footer class="site-footer">
			<div class="text-center">
				<p>
					&copy; Copyrights <strong>Dashio</strong>. All Rights Reserved
				</p>
				<div class="credits">
					Created with Dashio template by <a href="https://templatemag.com/">TemplateMag</a>
				</div>
				<a href="index.jsp#" class="go-top"> <i class="fa fa-angle-up"></i>
				</a>
			</div>
		</footer>
		<!--footer end-->
	</section>
	<!-- js placed at the end of the document so the pages load faster -->
</body>
<script src="${pageContext.request.contextPath }/lib/jquery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/lib/bootstrap/js/bootstrap.min.js"></script>
<script class="include" type="text/javascript"
	src="${pageContext.request.contextPath }/lib/jquery.dcjqaccordion.2.7.js"></script>
<script src="${pageContext.request.contextPath }/lib/jquery.scrollTo.min.js"></script>
<script src="${pageContext.request.contextPath }/lib/jquery.nicescroll.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath }/lib/jquery.sparkline.js"></script>
<!--common script for all pages-->
<script src="${pageContext.request.contextPath }/lib/common-scripts.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/lib/gritter/js/jquery.gritter.js"></script>
<script type="text/javascript" src="../lib/gritter-conf.js"></script>
<!--script for this page-->
<script src="${pageContext.request.contextPath }/lib/sparkline-chart.js"></script>
<script src="${pageContext.request.contextPath }/lib/zabuto_calendar.js"></script>
<script type="text/javascript">
$(function(){
	 $("#username").blur(function(){
		 if($("#username").val().trim() !=""){
			    var url="${pageContext.request.contextPath }/UserController";    
			    var args={uname:$("#username").val().trim(),op:"checkName"};
			    $.post(url,args,function(data){
			                       $("#userNameId").html(data);
			                    });
			}else{
				$("#userNameId").html("<font color='red'>用户名不能为空</font>");
			} 
	 });
	 $("#password").blur(function(){
		 if($("#password").val().trim().length>=6 && $("#password").val().trim().indexOf(" ")== -1){
		  $("#userPwdId").html("<font color='green'>密码正确</font>")
	 }else{
		 $("#userPwdId").html("<font color='red'>密码至少6位,不能包含空格</font>")
	 }
	 });
	 $("#usertel").blur(function(){
		 var tel=$(this).val().trim();
		 var reg_tel=/^1(3|4|5|7|8|9)[0-9]{9}$/;
		 var flag=reg_tel.test(tel);
		 if(flag){
			 $("#userTelId").html("<font color='green'>格式正确</font>")
		 }else{
			 $("#userTelId").html("<font color='red'>手机号必须为11位,以13,14,15,17,18,19开头</font>")
		 }
	 });
	 $("#regForm").submit(function(){
		  if($("#userNameId").text()=="可用" && $("#userPwdId").text()=="密码正确" &&  $("#userTelId").text()=="格式正确"){
			  return true;
		  }
		  return false;
	  });
})
</script>

</html>